package com.powerbank.common.result;

import lombok.Getter;

/**
 * 响应状态码枚举
 */
@Getter
public enum ResultCode {
    
    // 通用状态码
    SUCCESS(200, "操作成功"),
    ERROR(500, "操作失败"),
    PARAM_ERROR(400, "参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不允许"),
    
    // 用户相关状态码 (1000-1999)
    USER_NOT_EXIST(1001, "用户不存在"),
    USER_ALREADY_EXIST(1002, "用户已存在"),
    USERNAME_OR_PASSWORD_ERROR(1003, "用户名或密码错误"),
    USER_ACCOUNT_DISABLED(1004, "用户账号已禁用"),
    USER_ACCOUNT_LOCKED(1005, "用户账号已锁定"),
    PASSWORD_ERROR(1006, "密码错误"),
    PHONE_NUMBER_EXIST(1007, "手机号已存在"),
    EMAIL_EXIST(1008, "邮箱已存在"),
    VERIFICATION_CODE_ERROR(1009, "验证码错误"),
    VERIFICATION_CODE_EXPIRED(1010, "验证码已过期"),
    PHONE_NUMBER_NOT_EXIST(1011, "手机号不存在"),
    
    // 认证相关状态码 (2000-2999)
    TOKEN_INVALID(2001, "Token无效"),
    TOKEN_EXPIRED(2002, "Token已过期"),
    TOKEN_MISSING(2003, "Token缺失"),
    REFRESH_TOKEN_INVALID(2004, "刷新Token无效"),
    LOGIN_REQUIRED(2005, "请先登录"),
    PERMISSION_DENIED(2006, "权限不足"),
    IDENTITY_NOT_VERIFIED(2007, "未完成实名认证"),
    
    // 设备相关状态码 (3000-3999)
    DEVICE_NOT_EXIST(3001, "设备不存在"),
    DEVICE_OFFLINE(3002, "设备离线"),
    DEVICE_MAINTENANCE(3003, "设备维护中"),
    DEVICE_NO_POWERBANK(3004, "设备无可用充电宝"),
    DEVICE_FULL(3005, "设备已满"),
    POWERBANK_NOT_AVAILABLE(3006, "充电宝不可用"),
    
    // 订单相关状态码 (4000-4999)
    ORDER_NOT_EXIST(4001, "订单不存在"),
    ORDER_STATUS_ERROR(4002, "订单状态错误"),
    ORDER_ALREADY_FINISHED(4003, "订单已完成"),
    ORDER_CANNOT_CANCEL(4004, "订单无法取消"),
    USER_HAS_UNFINISHED_ORDER(4005, "用户有未完成订单"),
    RENTAL_TIME_EXCEEDED(4006, "租借时间超限"),
    
    // 支付相关状态码 (5000-5999)
    PAYMENT_ERROR(5001, "支付失败"),
    PAYMENT_TIMEOUT(5002, "支付超时"),
    PAYMENT_CANCELLED(5003, "支付已取消"),
    BALANCE_NOT_ENOUGH(5004, "余额不足"),
    DEPOSIT_REQUIRED(5005, "需要支付押金"),
    REFUND_ERROR(5006, "退款失败"),
    PAYMENT_REFUND_FAILED(5008, "支付退款失败"),
    PAYMENT_METHOD_NOT_SUPPORTED(5007, "不支持的支付方式"),
    
    // 钱包相关状态码 (6000-6999)
    WALLET_NOT_EXIST(6001, "钱包不存在"),
    WALLET_BALANCE_NOT_ENOUGH(6002, "钱包余额不足"),
    WITHDRAW_AMOUNT_INVALID(6003, "提现金额无效"),
    DAILY_WITHDRAW_LIMIT_EXCEEDED(6004, "超过日提现限额"),
    BANK_CARD_NOT_EXIST(6005, "银行卡不存在"),
    BANK_CARD_ALREADY_EXIST(6006, "银行卡已存在"),
    
    // 优惠券相关状态码 (7000-7999)
    COUPON_NOT_EXIST(7001, "优惠券不存在"),
    COUPON_EXPIRED(7002, "优惠券已过期"),
    COUPON_USED(7003, "优惠券已使用"),
    COUPON_NOT_AVAILABLE(7004, "优惠券不可用"),
    COUPON_LIMIT_EXCEEDED(7005, "优惠券使用次数超限"),
    
    // 系统管理相关状态码 (8000-8999)
    ADMIN_USER_NOT_EXIST(8001, "管理员用户不存在"),
    ADMIN_USER_ALREADY_EXIST(8002, "管理员用户已存在"),
    ROLE_NOT_EXIST(8003, "角色不存在"),
    ROLE_ALREADY_EXIST(8004, "角色已存在"),
    PERMISSION_NOT_EXIST(8005, "权限不存在"),
    CANNOT_DELETE_SYSTEM_ROLE(8006, "不能删除系统角色"),
    ADMIN_PASSWORD_ERROR(8007, "管理员密码错误"),
    
    // 业务逻辑相关状态码 (9000-9999)
    OPERATION_TOO_FREQUENT(9001, "操作过于频繁"),
    FILE_UPLOAD_ERROR(9002, "文件上传失败"),
    FILE_SIZE_EXCEEDED(9003, "文件大小超限"),
    FILE_TYPE_NOT_SUPPORTED(9004, "不支持的文件类型"),
    SMS_SEND_ERROR(9005, "短信发送失败"),
    EMAIL_SEND_ERROR(9006, "邮件发送失败"),
    SYSTEM_BUSY(9007, "系统繁忙，请稍后重试"),
    NETWORK_ERROR(9008, "网络错误"),
    DATA_SYNC_ERROR(9009, "数据同步失败");
    
    private final Integer code;
    private final String message;
    
    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}